//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.Interfaces {
    /// <summary>The interface used by the <see cref="WebCrawlerEngine"/> to store a history of previously completed requests, so that they are not visited again.</summary>
    /// <remarks>When the <see cref="WebCrawlerEngine"/> completes visiting a url, it notifies this class by calling <see cref="CompletedRequestHistory.AddCompletedRequest"/>.  
    /// When the engine begins processing in the future, it will store by loading previously completed requests by calling <see cref="CompletedRequestHistory.GetCompletedRequests"/>.
    /// Implementations can, therefore, choose if they want to prevents duplicates across runs.  Please note that this class does not prevent duplicate processing inside of one run.  
    /// This is the job of the <see cref="RequestStore"/>.</remarks>
    public interface CompletedRequestHistory : Eas.WebCrawler.Interfaces.WebCrawlerComponent, IDisposable{
        /// <summary>Returns requests completed in previous runs of the crawler.</summary>
        /// <returns>An enumeration of <see cref="Uri"/>s which have already been visited by the crawler.</returns>
        /// <remarks>Any <see cref="Uri"/>s returned by this function will not be processed if they are encountered by the engine while crawling.</remarks>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        IEnumerable<Uri> GetCompletedRequests();
        
        /// <summary>Adds a completed request so that it will not be processed again.</summary>
        /// <param name="uri">The uri which has been visited previously.</param>
        void AddCompletedRequest(Uri uri);
    }
}
